package com.hui.domain;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author Ayingzz
 * @create 2021/12/26 10:55
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    String uid; //用户id
    String uname; //用户名
    String userPassword; //口令
    String userFavouriteList; //我的喜爱

    public User(String json) throws JsonProcessingException {
        User user = new ObjectMapper().readValue(json, User.class);
        this.uid = user.getUid();
        this.uname = user.getUname();
        this.userPassword = user.getUserPassword();
        this.userFavouriteList = user.getUserFavouriteList();
    }
}
